package wwk.com.android_meilishuo.ui.home.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.wwk.core.utils.RecyclerViewAdapterHelper;
import com.wwk.core.views.PowerImageView;

import java.util.List;

import wwk.com.android_meilishuo.R;
import wwk.com.android_meilishuo.ui.home.bean.TrendBean;

/**
 * Created by Administrator on 2017/1/5.
 */

public class TrendAdapter extends RecyclerViewAdapterHelper<TrendBean.DataBean.ListBean>{
    public TrendAdapter(Context context, List<TrendBean.DataBean.ListBean> list) {
        super(context, list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateMyViewHolder(ViewGroup parent, int viewType) {
        View view=mInflater.inflate(R.layout.item_home_trend_recyclerview,null);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof MyViewHolder){
            MyViewHolder myViewHolder= (MyViewHolder) holder;
            TrendBean.DataBean.ListBean listBean=mList.get(position);
            Glide.with(mContext).load(listBean.getIndexBanner()).into(myViewHolder.imageView_trend_home);
            myViewHolder.textView_trend_month.setText(listBean.getMonth());
            myViewHolder.textView_trend_day.setText(listBean.getDay());
            myViewHolder.textView_trend_subtitle.setText(listBean.getSubTitle());
            myViewHolder.textView_trend_Title.setText(listBean.getTitle());
            myViewHolder.textView_trend_count.setText(listBean.getGoodsNum()+"");
        }
    }
    class MyViewHolder extends RecyclerView.ViewHolder{
        private PowerImageView imageView_trend_home;
        private TextView textView_trend_month,textView_trend_day,textView_trend_subtitle,textView_trend_Title,
                textView_trend_count;
        public MyViewHolder(View itemView) {
            super(itemView);
            imageView_trend_home= (PowerImageView) itemView.findViewById(R.id.imageView_trend_home);
            textView_trend_month= (TextView) itemView.findViewById(R.id.textView_trend_month);
            textView_trend_day= (TextView) itemView.findViewById(R.id.textView_trend_day);
            textView_trend_subtitle= (TextView) itemView.findViewById(R.id.textView_trend_subtitle);
            textView_trend_Title= (TextView) itemView.findViewById(R.id.textView_trend_Title);
            textView_trend_count= (TextView) itemView.findViewById(R.id.textView_trend_count);

        }
    }
}
